﻿<Page x:Class="ScoreMS.Views.CourseAdd"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:ScoreMS.Views"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="618"
	Title="CourseAdd">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="68" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock Text="添加课程" Grid.Row="0" TextAlignment="Center" FontSize="24"></TextBlock>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="346*" />
                <ColumnDefinition Width="272*" />
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="189*" />
                    <ColumnDefinition Width="157*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <TextBlock Name="textBlock1" Text="课程编号" Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="102" />
                <TextBox Grid.Row="0" Grid.Column="1" Name="txtcourse_id" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" />

                <TextBlock Grid.Row="1" Height="23" Name="textBlock2" Text="课程名称" VerticalAlignment="Top" HorizontalAlignment="Right" Width="102" />
                <TextBox Grid.Row="1" Grid.Column="1" Name="txtcourse_name" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120"/>

                <TextBlock Grid.Row="2" Name="textBlock0" Text="学分" Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="92" />
                <TextBox Grid.Row="2" Grid.Column="1" Name="txtcourse_points" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" />

                <TextBlock Grid.Row="3" Name="textBlock3" Text="课程类型（'必修','限选','任选'）" Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="170" />
                <TextBox Grid.Row="3" Grid.Column="1" Name="txtcourse_type" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" />

                <TextBlock Grid.Row="4" Name="textBlock4" Text="学生类型（'本科生','研究生'）" Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="170" />
                <TextBox Grid.Row="4" Grid.Column="1" Name="txtcourse_stutype" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" />

                <TextBlock Grid.Row="5" Name="textBlock5" Text="学时X" Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="92" />
                <TextBox Grid.Row="5" Grid.Column="1" Name="txtcourse_hours_x" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" />

                <TextBlock Grid.Row="6" Name="textBlock6" Text="学时Y" Height="23" HorizontalAlignment="Right" VerticalAlignment="Top" Width="92" />
                <TextBox Grid.Row="6" Grid.Column="1" Name="txtcourse_hours_y" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" />

                <Button Content="添加" Grid.Column="1" Grid.Row="7" Height="23" HorizontalAlignment="Left" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
            </Grid>
            <Grid Grid.Column="1" Height="230" HorizontalAlignment="Left" Name="grid1" VerticalAlignment="Top" Width="272">
                <Grid.Resources>
                    <local:VisibilityConverter x:Key="visibilityFromBool" />
                </Grid.Resources>
                <RadioButton Content="按班级开设" Height="16" HorizontalAlignment="Left" Margin="20,7,0,0" Name="rbnClass" VerticalAlignment="Top" />
                <RadioButton Content="按专业方向开设" Height="16" HorizontalAlignment="Left" Margin="123,7,0,0" Name="rbnPro" VerticalAlignment="Top" />
                <ListBox Name="lstClass" SelectionMode="Multiple" Visibility="{Binding Path=IsChecked, ElementName=rbnClass, Converter={StaticResource visibilityFromBool}}" Height="185" HorizontalAlignment="Left" Margin="28,29,0,0" VerticalAlignment="Top" Width="195">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding class_id}" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Mode=TwoWay}"></CheckBox>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <!--TODO：加个专业方向的ListBox，显示与否跟RadioButton对应-->
                <ListBox Name="lstPro" Visibility="{Binding Path=IsChecked, ElementName=rbnPro, Converter={StaticResource visibilityFromBool}}" Height="185" HorizontalAlignment="Left" Margin="28,29,0,0" VerticalAlignment="Top" Width="195">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding pro_emphasis_name}" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Mode=TwoWay}"></CheckBox>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Grid>
        </Grid>
    </Grid>
</Page>
